<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.min.js"></script>
</head>
    
<body>
    <div id="app">
		<img :src="path" alt="图片" width="800px" @mouseover="mouseover" @mouseout="mouseout" />
	</div>
	
	<script type="text/javascript">
		const app = new Vue({
			el: "#app",
			data: {
				path: 'img/1.jpg'
			},
			methods: {
				mouseover(event) {
					event.target.style.opacity = 0.5,
					this.path = 'img/2.gif'
				},
				mouseout(event) {
					event.target.style.opacity = 1,
					this.path = 'img/1.jpg'
				}
			}
		})
	</script>
</body>
</html>